<?php loadTemp("global/empty_header.php");?>
<style type="text/css">
body {
	background-color: #DADADA;
}

body>.grid {
	height: 80%;
}

.image {
	margin-top: -100px;
}

.column {
	max-width: 450px;
}
</style>

<script type="text/javascript">
function dealResultMessage(state,mess){
	console.log(state);
	console.log(mess);
	$("#waiting").hide();
	$("#resultmessage").show();
	if(state=="0"){
		$("#resultmessage").attr("class","ui error message");
		$("#mess").text(mess);
		return;
	}else{
		$("#resultmessage").attr("class","ui success message");
		$("#mess").text(mess);
		return;
	}
	
}
function retry(){
	$("#waiting").show();
	$("#resultmessage").hide();
	 $.ajax({
	   		type: "POST",
	    	dataType: "json",
	    	url:"misc.php?ajax=true&op=sendVerify",
	    	data:$('#form').serialize(),
	    	complete:function (e) {
	    		try{ 
	    			var json = eval(e.responseJSON);
	    			dealResultMessage(json["state"],json["message"]);
	    		}catch(err){
	    			dealResultMessage(0,"服务器返回未知数据，请联系管理员\n"+e.responseText);
	    			return;
			    }
	    		
	    	}
	    });
}
$(document)
.ready(function() {
	if($("#state").hasClass("needmail")){
	   retry();
	}
});
</script>
<div class="ui middle aligned center aligned grid">
	<div class="column">
		<div class="ui stacked segment">
			<h2 class="ui image header">学生云系统</h2>
			<h4 class="ui horizontal divider header">
				<i class="user icon"></i> 注册结果
			</h4>
			<?php global $mail;if($mail){?>
			<br id="state" class="needmail">
			<div class="ui icon message" id="waiting">
				<i class="notched circle loading icon" id="wait"></i>
				<div class="content">
					<div class="header">注冊快要完成了...</div>
					<p id="message">您的账号已经被创建。我们正在给您的邮箱发送一封验证邮件，请稍后</p>
				</div>
			</div>
			<div class="ui message" id="resultmessage">
				<div class="content">
					<p id="mess"></p>
				</div>
			</div>
			<?php }else{?>
			<br id="state" class="notneedmail">
			<div class="ui icon success message" id="success">
				<i class="paper plane icon"></i>
				<div class="content">
					<div class="header">注册成功</div>
					<p>
						现在你可以前往你的 <a href='home.php?mod=home'>个人主页 </a> 了
					</p>
				</div>
			</div>
			<?php }?>
		</div>
	</div>
</div>
</body>
</html>